﻿using MediatR;
using Microsoft.Data.SqlClient;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Options;
using S.Authorization.API.Application.Command.UserCommand;
using S.Authorization.Domain.Model.User;
using S.Authorization.Infrastructure;
using S.Authorization.Infrastructure.Interface.User;

namespace S.Authorization.API.Application.CommandHandlers.UserCommandHandler
{
    /// <summary>
    /// 用户表删除
    /// </summary>
    public class UserDeleteCommandHandler : IRequestHandler<UserDeleteCommand, bool>
    {
        private readonly IUserModellRepository repository;
        #region 注入
        public UserDeleteCommandHandler(IUserModellRepository repository)
        {
            this.repository = repository;
 
        }
        #endregion
        public async Task<bool> Handle(UserDeleteCommand request, CancellationToken cancellationToken)
        {
            return await repository.DeleteAsync(request.UserId);
        }

    }
}
